using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Helper;
namespace CoreData
{
    public class Stock_VoucherOutDetail
    {
            public long ID{get;set;}
            public long Stock_VoucherOutID { get; set; }
            public long ProductID { get; set; }
            public long Quantity { get; set; }
            public decimal Price{get;set;}
            public decimal Amount{get;set;}
            public long UnitID{get;set;}
            public string ProductNameExt { get; set; }
            public string UnitNameExt { get; set; }
            public string ProductCodeExt { get; set; }
         
        public Stock_VoucherOutDetail()
        {       
        }
        
       static Stock_VoucherOutDetail DynamicCast<T>(object row_data, object row_header) where T : Stock_VoucherOutDetail
       {
           // row_data : DataRow
           // row_header : DataColumnCollection
           Stock_VoucherOutDetail ret = new Stock_VoucherOutDetail();
           DataRow dt = (DataRow)row_data;

           foreach (DataColumn column in (DataColumnCollection)row_header)
           {
               switch (column.ColumnName)
               {
                      case  "ID":
                        ret.ID = ConvertObject.ToInt(dt[column]);
                       break;
                      case  "Stock_VoucherOutID":
                        ret.Stock_VoucherOutID = ConvertObject.ToInt(dt[column]);
                       break;
                      case  "ProductID":
                        ret.ProductID = ConvertObject.ToInt(dt[column]);
                       break;
                      case  "Quantity":
                        ret.Quantity = ConvertObject.ToInt(dt[column]);
                       break;
                      case  "UnitID":
                        ret.UnitID = ConvertObject.ToInt(dt[column]);
                       break;
                      case "Price":
                       ret.Price = ConvertObject.ToDecimal(dt[column]);
                       break;
                      case "Amount":
                       ret.Amount = ConvertObject.ToDecimal(dt[column]);
                       break;
                      case "UnitName":
                       ret.UnitNameExt = ConvertObject.ToString(dt[column]);
                       break;
                      case "ProductCode":
                       ret.ProductCodeExt = ConvertObject.ToString(dt[column]);
                       break;
                      case "ProductName":
                       ret.ProductNameExt = ConvertObject.ToString(dt[column]);
                       break;                
                   default:
                       break;
               }
           }

           return ret;
       }
        
    }
}
